package com.itheima.homework16;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Demo2 {
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        /*
        请使用反射技术，创建该类的对象，并为对象的属性赋值，
        然后反射调用显示信息的方法。
         */

        Class clazz=Student.class;

        Student stu = (Student) clazz.getConstructor(String.class, int.class).newInstance("zhangsan", 23);
        Method method = clazz.getMethod("showInfo");
        method.invoke(stu);

    }
}
